<?php
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );

/**
*
* @package  RealEstateManager
* @copyright 2011 Andrey Kvasnevskiy-OrdaSoft(akbet@mail.ru); Rob de Cleen(rob@decleen.com) 
* Homepage: http://www.ordasoft.com
* @version: 2.1 free $
*
**/

$mainframe = $GLOBALS['mainframe'] = & JFactory::getApplication(); // for 1.6

if( stristr( $_SERVER['PHP_SELF'], 'administrator')) {
	@define( '_VM_IS_BACKEND', '1' );
}
defined('_VM_TOOLBAR_LOADED' ) or define('_VM_TOOLBAR_LOADED', 1 );

include_once( dirname(__FILE__).'/compat.joomla1.5.php' );


$path = JPATH_SITE."/administrator/components/com_realestatemanager/";
// ensure this file is being included by a parent file


require_once( $path . 'toolbar_ext.php' );
require_once( $path . 'toolbar.realestatemanager.html.php' );
require_once ( JPATH_BASE .DS.'components'.DS.'com_realestatemanager'.DS.'functions.php' );

$section = mosGetParam( $_REQUEST, 'section', 'courses' );


if (isset($section) && $section=='categories') { 

switch ($task) {
         
	case "add":
		menucat::NEW_CATEGORY();
    addSubmenuRealEstate("Categories");
		break;
	case "edit":
		menucat::EDIT_CATEGORY();
    addSubmenuRealEstate("Categories");
		break;
	default:
		menucat::SHOW_CATEGORIES();
    addSubmenuRealEstate("Categories");
		break;
  }
} else {


switch ($task) {

	case "add":
		menurealestatemanager::MENU_SAVE_BACKEND();
    addSubmenuRealEstate("Houses");
		break;

	case "edit":
		menurealestatemanager::MENU_EDIT();
    addSubmenuRealEstate("Houses");
		break;
		
	case "show_import_export":
		menurealestatemanager::MENU_IMPORT_EXPORT();
    addSubmenuRealEstate("Import/Export");
		break;
		
	case "rent":
		menurealestatemanager::MENU_RENT();
    addSubmenuRealEstate("Rent Requests");
		break;

	case "edit_rent":
		menurealestatemanager::MENU_EDIT_RENT();
    addSubmenuRealEstate("Rent Requests");
		break;

	case "rent_return":
		menurealestatemanager::MENU_RENT_RETURN();
    addSubmenuRealEstate("Rent Requests");
		break;

	case "rent_requests":
		menurealestatemanager::MENU_RENTREQUESTS();
    addSubmenuRealEstate("Rent Requests");
		break;

	case "buying_requests":
		menurealestatemanager::MENU_BUYINGREQUESTS();
    addSubmenuRealEstate("Sale Manager");
		break;

	case "import":
		menurealestatemanager::MENU_CANCEL();
    addSubmenuRealEstate("Import/Export");
		break;

	case "export":
		menurealestatemanager::MENU_CANCEL();
    addSubmenuRealEstate("Import/Export");
		break;
	
	case "config":
		menurealestatemanager::MENU_CONFIG();
    addSubmenuRealEstate("Settings");
		break;


	case "config_save":
		menurealestatemanager::MENU_CONFIG();
    addSubmenuRealEstate("Settings");
		break; 

	case "about":
		menurealestatemanager::MENU_ABOUT();
    addSubmenuRealEstate("About");
		break;
  case "delete_review":
    menurealestatemanager::MENU_DELETE_REVIEW();
    break;

  case "edit_review":
    menurealestatemanager::MENU_EDIT_REVIEW();
    break;

  case "update_review":
    menurealestatemanager::MENU_EDIT();
    break;

  case "cancel_review_edit":
    menurealestatemanager::MENU_EDIT();
    break;

//**************   begin for manage reviews   *********************
  case "manage_review":
    menurealestatemanager::MENU_MANAGE_REVIEW();
    break;

  case "delete_manage_review":
    menurealestatemanager::MENU_MANAGE_REVIEW_DELETE();
    break;

  case "edit_manage_review":
    menurealestatemanager::MENU_MANAGE_REVIEW_EDIT();
    break;

  case "update_edit_manage_review":
    menurealestatemanager::MENU_MANAGE_REVIEW_EDIT_EDIT();
    break;

  case "cancel_edit_manage_review":
    menurealestatemanager::MENU_MANAGE_REVIEW_EDIT_EDIT();
    break;

  case "sorting_manage_review_numer":
    menurealestatemanager::MENU_MANAGE_REVIEW();
    break;

  case "sorting_manage_review_mls":
    menurealestatemanager::MENU_MANAGE_REVIEW();
    break;

  case "sorting_manage_review_title_house":
    menurealestatemanager::MENU_MANAGE_REVIEW();
    break;

  case "sorting_manage_review_title_category":
    menurealestatemanager::MENU_MANAGE_REVIEW();
    break;

  case "sorting_manage_review_title_review":
    menurealestatemanager::MENU_MANAGE_REVIEW();
    break;

  case "sorting_manage_review_user_name":
    menurealestatemanager::MENU_MANAGE_REVIEW();
    break;

  case "sorting_manage_review_date":
    menurealestatemanager::MENU_MANAGE_REVIEW();
    break;

  case "sorting_manage_review_rating":
    menurealestatemanager::MENU_MANAGE_REVIEW();
    break;
//**************   end for manage reviews   ***********************
	default:
		menurealestatemanager::MENU_DEFAULT();
    addSubmenuRealEstate("Houses");
		break;
}

} //else

